import { createWebHistory, createRouter } from 'vue-router';
import Layout from "@/Layout/index.vue";
import type { RouterRecord } from "@/global/record/RouterRecord";
import baseRouters from "./base-routers";
import homeRouters from "./home-routers";
import userRouters from "./user-routers";
import aboutRouters from "./about-routers";
import systemRouters from "./system-routers";


export const constantRoutes: RouterRecord[] = [
  {
    path: '/redirect',
    component: Layout,
    hidden: true,
    children: [
      {
        path: '/redirect/:path(.*)',
        component: () => import('@/views/redirect/index.vue')
      }
    ]
  },
  {
    path: '',
    redirect: '/home',
  },
  {
    path: '/',
    component: Layout,
    children: [
      ...homeRouters,
      ...userRouters,
      ...aboutRouters,
      ...systemRouters,
    ]
  },
  ...baseRouters,

]

const router = createRouter({
  history: createWebHistory(import.meta.env.VITE_APP_BASE_URL),
  routes: constantRoutes,
})
export default router